/*
 * Copyright (c) 2009-2013 EvTech Project
 * All rights reserved.
 * 
 * This file is part of LModeller.
 *
 * LModeller is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or 
 * (at your option) any later version.
 *
 * LModeller is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with LModeller.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
package fi.honkalampisaatio.lmodeller;

import java.util.Enumeration;
import java.util.Hashtable;


public class LanguageResource {
	
	public static LanguageResource INSTANCE;
	private Hashtable<String, String> dic;
	
	public static LanguageResource getInstance() {
		if(INSTANCE==null) {
			INSTANCE = new LanguageResource();
		}
		return INSTANCE;
	}
	
	public LanguageResource() {
		dic = new Hashtable<String, String>();
		dic.put("CHOOSE_USER_TITLE", "Valitse käyttäjä");
		dic.put("LOADING", "Ladataan...");
		
		dic.put("RANDOM_MODEL", "Satunnainen malli");
		dic.put("FIGURATIVE_MODELS", "Esittävät mallit");
		dic.put("CHOOSE_GAME", "Valitse peli");
		dic.put("SETTINGS", "Asetukset");
		dic.put("MEMORY_GAME", "Muistipeli");
		dic.put("BUILD_GAME", "Rakenna ohjeiden mukaan");

		dic.put("CHOOSE_BLOCK_COUNT", "Valitse palikoiden määrä");
		dic.put("CHOOSE_MODEL", "Valitse malli");

		dic.put("LOOK", "Katso");
		dic.put("READY", "Valmis");
		dic.put("BUILD", "Rakenna");
		dic.put("CHECK", "Tarkista");
		dic.put("MEMORIZE", "Paina mieleen");
		
		dic.put("OK_BUTTON", "OK");

		dic.put("CHOOSE_MUSIC", "Valitse musiikki");
		dic.put("EXIT_BUTTON", "LOPETA PELI");
	}

	public void setValue(String key, String value)
	{
		if(key==null || value==null)
			return;
		dic.put(key, value);
	}
	
	public String get(String key) {
		return dic.get(key);
	}
	
	public String getKey(String value) {
		Enumeration<String> keyList = dic.keys();
		while(keyList.hasMoreElements()) {
			String key = keyList.nextElement();
			if(dic.get(key).equalsIgnoreCase(value)) {
				return key;
			}
		}
		return null;
	}

}
